package com.cqq.print.business.service.impl;


import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cqq.print.business.dao.PArticleDao;
import com.cqq.print.business.dao.domain.PArticle;
import com.cqq.print.business.service.PArticleService;
import com.cqq.print.business.service.bean.PArticleBean;


/**
 * @author CHENQQ
 * @date 2015-07-01
 */


@Service(value="pArticleService")
public class PArticleServiceImpl implements PArticleService{

             @Autowired
             private PArticleDao pArticleDao;
             
			
			public int insertSelective(PArticleBean bean) {
				if(bean==null)
					return 0;
				PArticle pArticle = new PArticle();
				BeanUtils.copyProperties(bean, pArticle);
				return pArticleDao.insertSelective(pArticle);
			}

			
			public int deleteByPrimaryKey(Integer id) {
				return pArticleDao.deleteByPrimaryKey(id);
			}

			
			public PArticleBean selectByPrimaryKey(Integer id) {
				PArticle pArticle = pArticleDao.selectByPrimaryKey(id);
				if(pArticle==null)
					return  null;
				PArticleBean bean = new PArticleBean();
				BeanUtils.copyProperties(pArticle,bean);
				return bean;
			}

			
			public int updateByPrimaryKeySelective(PArticleBean bean) {
				if(bean==null||bean.getId()==null||bean.getId()<1)
					return 0;
				PArticle pArticle = new PArticle();
				BeanUtils.copyProperties(bean, pArticle);
				return pArticleDao.updateByPrimaryKeySelective(pArticle);
			}

}